package com.hyjiacan.apps.audionly.ui

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.hyjiacan.apps.audionly.R
import com.hyjiacan.apps.audionly.databinding.ActivityResultBinding

/**
 * 提取结果界面Activity
 */
class ResultActivity : AppCompatActivity() {
    private lateinit var binding: ActivityResultBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, R.layout.activity_result)

        // 从Intent获取输出文件路径
        val outputPath = intent.getStringExtra("output_path")
        outputPath?.let {
            binding.resultText.text = "提取成功！\n文件已保存至：\n$it"
        }

        // 设置返回首页按钮点击事件
        binding.backToHomeBtn.setOnClickListener {
            val intent = Intent(this, MainActivity::class.java)
            intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
            startActivity(intent)
            finish()
        }
    }
}